package com.fanshuai.soring.boot;


import com.fanshuai.soring.boot.annotations.EnableMetrics;
import com.fanshuai.soring.boot.annotations.EnableRequestLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.HandlerAdapter;
import org.springframework.web.servlet.HandlerMapping;

import java.util.Map;

@Slf4j
@SpringBootApplication
//@EnableRequestLog
@EnableMetrics
public class ApplicationStarter {
    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(ApplicationStarter.class, args);

        Map<String, HandlerMapping> handlerMappingMap = context.getBeansOfType(HandlerMapping.class);
        log.info("handler mappings={}", handlerMappingMap);

        Map<String, HandlerAdapter> handlerAdapterMap = context.getBeansOfType(HandlerAdapter.class);
        log.info("handler adapters={}", handlerAdapterMap);

        Map<String, FilterRegistrationBean> filterMap = context.getBeansOfType(FilterRegistrationBean.class);
        log.info("filters={}", filterMap);

        Map<String, ServletRegistrationBean> servletMap = context.getBeansOfType(ServletRegistrationBean.class);
        log.info("servletMap={}", servletMap);
    }
}
